package com.yuqian.JavaSe.snio;

import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.nio.channels.SocketChannel;
import java.util.LinkedList;
import java.util.List;



public class Test {
	public static void main(String[] args) throws IOException {
		/*String rul = Test.class.getResource("").getPath();
		File file = new File(rul+"test.txt");
		System.out.println(file.exists());
		System.out.println(rul);
		RandomAccessFile aFile = new RandomAccessFile(file, "rw");
		FileChannel inChannel = aFile.getChannel();
		ByteBuffer buf = ByteBuffer.allocate(48);
		int bytesRead = inChannel.read(buf);
		byte[] by = new byte[1024];
		int i=0;
		while (bytesRead != -1) {
			System.out.println("Read " + bytesRead);
			buf.flip();
			while (buf.hasRemaining()) {
				//System.out.print((char) buf.get());
				by[i++] = buf.get();
			}

			buf.clear();
			bytesRead = inChannel.read(buf);
		}
		aFile.close();
		System.out.println(new String(by,0,i,"utf-8" ));*/
		int a =1<<2;
		System.out.println(a);
		SocketChannel socketChannel = SocketChannel.open();
		socketChannel.connect(new InetSocketAddress("http://www.baidu.com", 80));

	}
}
